package com.longshihan.testart.mvp.ui.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.longshihan.mvplh.base.BaseMVPActivity;
import com.longshihan.mvplh.dagger.component.AppComponent;
import com.longshihan.mvplh.utils.ArouterUtil;
import com.longshihan.testart.R;
import com.longshihan.testart.dagger.component.DaggerUserActivityComponent;
import com.longshihan.testart.dagger.module.UserModule;
import com.longshihan.testart.mvp.contract.TestContract;
import com.longshihan.testart.mvp.presenter.TestPersenter;

@Route(path = "/app/TestMVPActivity", extras = ArouterUtil.CheckLOGIN)
public class TestMVPActivity extends BaseMVPActivity<TestPersenter> implements TestContract.View {

    AppComponent mAppComponent;
    private TextView mTextView;
    private TextView mToutiao;
    private TextView mToolView;

    @Override
    public void setupActivityComponent(AppComponent appComponent) {
        DaggerUserActivityComponent.builder()
                .appComponent(appComponent)
                .userModule(new UserModule(this))
                .build()
                .inject(this);
        mAppComponent = appComponent;
    }

    @Override
    public int initView(Bundle savedInstanceState) {
        return R.layout.activity_test;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mTextView = getView(R.id.app_maintext);
        mToutiao = getView(R.id.app_mainjuhe);
        mToolView=getView(R.id.app_mainother);
        mPresenter.StartTask();

        mTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //  ARouter.getInstance().build("/main/MainActivity").navigation();
                ARouter.getInstance().build("/dandu/SplashActivity")
                        .withInt("age", 13)
                        .withString("name", "888")
                        .withBoolean("girl", false)
                        .navigation();
            }
        });
        mToutiao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ARouter.getInstance().build("/toutiao/MainActivity")
                        .withInt("age", 13)
                        .withString("name", "888")
                        .withBoolean("girl", false)
                        .navigation();
            }
        });
        mToolView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
    }

    @Override
    public boolean useFragment() {
        return false;
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showError(int type, String message) {

    }

    @Override
    public void closeActivity() {

    }


    @Override
    public void startLoadMore() {

    }

    @Override
    public void endLoadMore() {

    }
}
